package com.crm.kz.common;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.crm.kz.R;
import com.crm.kz.menu.MainActivity;
import com.crm.kz.menu.MenuFragment;
import com.xuexiang.xui.widget.actionbar.TitleBar;

public abstract class BaseFragment extends Fragment {

    protected Context mContext;

    protected TitleBar titleBar;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MainActivity ma = (MainActivity) getActivity();
        titleBar = ma.getTitleBar();
        titleBar.removeAllActions();
        titleBar.setLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MenuFragment menuFragment = MenuFragment.newInstance();
                FragmentManager fm = ma.getSupportFragmentManager();
                fm.beginTransaction()
                        .replace(R.id.fragment_container, menuFragment)
                        .commit();
                titleBar.setVisibility(View.GONE);
            }
        });

    }

    
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }


}
